import Vue from 'vue'
import App from './App.vue'
import router from  './router/index'
import store from './store/index'

import Element from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import '@/assets/iconfont/iconfont.css'

import { MarkdownPro } from 'vue-meditor'
import moment from 'moment'
import https from '../https.js'
Vue.use(https)

// 引入axios，并加到原型链中
import axios from 'axios';
import QS from 'qs'
Vue.config.productionTip = false
Vue.prototype.$axios = axios;
Vue.prototype.qs = QS;
Vue.use(MarkdownPro)
Vue.use(Element);


// 根据路由设置标题
router.beforeEach((to, from, next) => {
  /*路由发生改变修改页面的title */
  if(to.meta.title) {
    document.title = 'Cofa博客 - ' +to.meta.title
  }
  next();
})


Vue.filter('dateformat', function(dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {

  return moment(dataStr).format(pattern)

})

new Vue({
  render: h => h(App),
  router,
  store
}).$mount('#app')
